import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 言初
 * Date: 2023-04-18
 * Time: 8:37
 */
public class Factorial {
    static IntCall fact;

    public static void main1(String[] args) {
        //Scanner sc=new Scanner(System.in);
        //使用lambda表达式来实现的递归
        int m=8;
        fact=(n)->(n==0?1:n*fact.call(n-1));
        for(int i=1;i<=8;i++){
            System.out.println(fact.call(i));
        }
    }


    public static void main(String[] args) {
        int m=8;
        System.out.println(m+"的阶乘是："+func2(m));//40320
    }
    public static int func2(int n){
        //求一个数的阶乘
        if(n==0){
            return 1;
        }
        return n*func2(n-1);
    }
}
